package com.liu.controller;

import com.liu.config.DbConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope //注册实现配置自动更新
public class UserController {

    /*配置自动更新注解和属性注入必须都在控制类中，自动更新才生效*/
    @Value("${db.url}")
    String url;
    @Value("${db.username}")
    String username;
    @Value("${db.password}")
    String password;


    @GetMapping("/user")
    public String get(){
        return "ok";
    }


}
